using System;
using System.ComponentModel;
using System.Data;
using System.Collections.Generic;

namespace PlacementManager
{
    public partial class vwVenuesWPlacementTypeComponent
    {
		//
		// TODO: Add constructor logic here
		//

        /// <summary>
        /// Selects all records from the database table.
        /// </summary>
        /// <returns>A collection of objects of a type representing a row in the database table.</returns>
		[DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
		public List<vwVenuesWPlacementType> SelectAllWPlacementTypeId(int placementTypeId, string sortExpression)
        {
            List<vwVenuesWPlacementType> listvwVenuesWPlacementType = new List<vwVenuesWPlacementType>();
            PlacementManager.DAL.vwVenuesWPlacementType_DAL o = new PlacementManager.DAL.vwVenuesWPlacementType_DAL();

            DataSet ds = o.SelectAllWPlacementTypeId(placementTypeId);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                listvwVenuesWPlacementType.Add(new vwVenuesWPlacementType((string)row["VenueName"], (string)row["TelephoneNumber"], (string)row["Fax"], (string)row["GenericEmail"], (bool)row["IsRestricted"], (int)row["MaxNumStudents"], (bool)row["VenueSuppliedEducator"], (string)row["Address1"], (string)row["Address2"], (string)row["City"], (string)row["PostCode"], (string)row["DivisionName"], (string)row["CountryName"], (double)row["Latitude"], (double)row["Longitude"], (int)row["PlacementTypeId"], (bool)row["IsPrimary"], (bool)row["IsActive"], (bool)row["VenueActive"]));
            }
			
			if (sortExpression == string.Empty)
            {
                sortExpression = "VenueName desc";
            }

            listvwVenuesWPlacementType.Sort(new vwVenuesWPlacementTypeComparer(sortExpression));
            return listvwVenuesWPlacementType;
        }
	}
}
